GBML manual / Drawing

ANCHOR_TOP_CENTER

Names the middle of the top edge of the screen, for draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored and draw_rect_fill_anchored - the position you give them is measured from this spot.

Syntax

ANCHOR_TOP_CENTER: constant

Description

Names the middle of the top edge of the screen. Give it to draw_text_anchored, draw_text_warped_anchored, draw_text_3d_anchored, draw_rect_anchored or draw_rect_fill_anchored as their first argument, and the position you give after it is measured from this spot. The screen anchors page explains the idea in full.

Example

text_align(ALIGN_CENTER);
draw_text_anchored(ANCHOR_TOP_CENTER, 0, 4, "STAGE 1");

STAGE 1, centered along the top edge and 4 pixels down. The offset 0 means "no sideways move", so the text stays in the middle. text_align makes the text center itself on that point instead of starting there.

On the GBA

The screen is 240 pixels wide and 160 tall, and a plain draw call in a Draw GUI event counts from its top-left pixel, so this spot is the point (120, 0) in their numbers. ANCHOR_TOP_CENTER with an offset of (x, y) lands on exactly the same pixel as the plain call in a Draw GUI event (x + 120, y) - the same spot, written by what it means instead of by the size of the screen.

See also: Screen anchorsdraw_text_anchoreddraw_rect_fill_anchored